package com.hopu.oa.dao.process;


import com.hopu.oa.entity.management.AoaTypeList;
import com.hopu.oa.entity.process.*;
import com.hopu.oa.entity.user.AoaDept;
import com.hopu.oa.entity.user.AoaPosition;
import com.hopu.oa.entity.user.AoaUser;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface NewProcessDao2 {


    /*
      @Description : 查询状态
      @Date   :  2021/11/22
      @Param  : []
      @return : java.util.List<com.hopu.oa.entity.management.AoaStatusList>
     */

    List<AoaTypeList> queryType(int[] array);


    /*
      @Description : 通讯录
      @Date   :  2021/11/22
      @Param  : [userName, index, size]
      @return : java.util.List<com.hopu.oa.entity.user.AoaUser>
     */
    List<AoaUser> findUserInfo(String baseKey, int index, int size);


    //查询部门
    @Select("select * from aoa_dept")
    List<AoaDept> queryDept();

    //查询职位
    @Select("select * from aoa_position")
    List<AoaPosition> queryPosition();


    /*
      @Description : 转正表
      @Date   :  2021/11/23
      @Param  : [regular]
      @return : int
     */
    @Insert("insert into aoa_regular(pro_id,understand,experience,pullulate,deficiency,dobetter,advice,days)" +
            "values(                     #{proId}, #{understand},#{experience},#{pullulate},#{deficiency},#{dobetter},#{advice},#{days})")
    int insertRegular(AoaRegular regular);
    //understand=职责理解, experience=心得, pullulate=成长, deficiency=不足, dobetter=做的更好, advice=建议加薪)



     /*
       @Description : process
       @Date   :  2021/11/23
       @Param  : [process]
       @return : void
      */

    /*@Options(useGeneratedKeys = true,keyProperty = "processId",keyColumn = "process_id")
     @Insert("insert into aoa_process_list" +
             "(apply_time, deeply_id, end_time, process_name, procsee_days,is_checked,start_time,status_id,process_user_id,shenuser,type_name)" +
     "values(#{applyTime}, #{deeplyId}, #{endTime},#{processName} ,#{procseeDays} ,#{isChecked} ,#{startTime},#{statusId},#{processUserId},#{shenuser},#{typeName})")
     int insertProcess(AoaProcessList process);*/

    @Options(useGeneratedKeys = true, keyProperty = "processId", keyColumn = "process_id")
    @Insert("insert into aoa_process_list" +
            "(apply_time, deeply_id, end_time, process_name, procsee_days,is_checked,start_time,status_id,process_user_id,shenuser,type_name,process_des)" +
            "values(#{applyTime}, #{deeplyId}, #{endTime},#{processName} ,#{procseeDays} ,#{isChecked} ,#{startTime},#{statusId},#{processUserId},#{shenuser},#{typeName},#{processDes})")
    int insertProcess_holiday(AoaProcessList process);


    @Insert("insert into aoa_holiday(type_id,pro_id) values(#{typeId},#{proId})")
    int inserHoliday(AoaHoliday holiday);


    @Insert("insert into aoa_process_list(apply_time, deeply_id,process_des,)")
    int insertProcess_resign(AoaProcessList process);


    int insertProcess(AoaProcessList process);


    @Select("select user_id from aoa_user where user_name = #{handuser}")
    int queryUserIdByName(String handuser);


    @Insert("insert into aoa_resign(is_finish,nofinish,hand_user,pro_id) values(#{isFinish},#{nofinish},#{handUser},#{proId})")
    int insertResign(AoaResign resign);

    //附件
    int inertAttachment(AoaAttachmentList attachment);


    //加班
    @Insert("insert into aoa_overtime(type_id,pro_id) values(#{typeId},#{proId}) ")
    int insertOvertime(AoaOvertime overtime);

    @Insert("insert into aoa_evection(type_id,pro_id) values(#{typeId},#{proId})")
    int insertEvection(AoaEvection evection);

    List<AoaSubject> querySubject();


    int inertBursement(AoaBursement bursement);


    /*
      @Description : 审核表
      @Date   :  2021/11/24
      @Param  : [reviewed]
      @return : int
     */
    int insertReviewed(AoaReviewed reviewed);


    @Insert("insert into aoa_detailsburse(descript,detailmoney,invoices,produce_time,subject,bursment_id) values(#{descript},#{detailmoney},#{invoices},#{produceTime},#{subject},#{bursmentId})")
    int insertDetails(Details details);


    //通讯录
    List<AoaUser> findUserInfoByName(String userName, Integer userId, @Param("index") int index, @Param("size") int size, int roleId);
}
